using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BricksWallCtrl : MonoBehaviour
{
    private BricksData Data;
    [SerializeField]
    private BrickCtrl[] m_Brcs;

    //private void Start()
    //{
    //    //Data = new BricksData() { MoveSpeed = 1, RightIdx = 2 };
    //    //SetState();
    //}

    public void SetState(BricksData data)
    {
        Data = data;
        for (int i = 0; i < m_Brcs.Length; i++)
        {
            m_Brcs[i].SetState(false);
        }
        m_Brcs[Data.RightIdx].SetState(true);
    }



    private void OnTriggerEnter2D(Collider2D col)
    {
        Debug.Log(col.name);
        if (col.name.Equals("Player"))
        {
            //if (Random.value < 0.5f)
                col.GetComponent<PlayerCtrl>().Rush();

            Destroy(gameObject);
        }
    }
}
